package com.jule.teenpatti.mail.network;

import com.jule.teenpatti.mail.network.protocol.ClientAck;
import com.jule.teenpatti.mail.network.protocol.acks.*;
import com.jule.teenpatti.mail.service.holder.FunctionIdHolder;

import java.util.HashMap;
import java.util.Map;

public class ServerOps {
    private static Map<Class<? extends ClientAck>, Integer> opcodes = new HashMap<>();

    static {
        opcodes.put(DispacherPongAck_01.class, 0x08000000 | 1);

        opcodes.put(JoloAuth_RedDotAck_600020.class, FunctionIdHolder.Mail_ACK_RedDots);

        opcodes.put(JoloAuth_MailListAck_600021.class, FunctionIdHolder.Mail_ACK_MailList);
        opcodes.put(JoloAuth_MailCheckAck_600022.class, FunctionIdHolder.Mail_ACK_MailCheck);
        opcodes.put(JoloAuth_MailAwardAck_600023.class, FunctionIdHolder.Mail_ACK_MailAward);
        opcodes.put(JoloAuth_MailDelAck_600024.class, FunctionIdHolder.Mail_ACK_MailDel);

    }

    /**
     * @param clazz
     * @return
     */
    public static int getOpCode(Class<? extends ClientAck> clazz) {
        if (!opcodes.containsKey(clazz)) {
            throw new IllegalArgumentException("opCode not find");
        }
        return opcodes.get(clazz);
    }
}
